package com.atgugui.gulimall.search.controller;

import com.atgugui.gulimall.search.service.MallSearchService;
import com.atgugui.gulimall.search.vo.SearchParamVo;
import com.atgugui.gulimall.search.vo.SearchResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {
    @Autowired
    private MallSearchService mallSearchServiceImpl;

    @GetMapping("/list.html")
    public String list(SearchParamVo paramVo, Model model){
        SearchResultVo resultVo = mallSearchServiceImpl.search(paramVo);
        model.addAttribute("result", resultVo);
        return "list";
    }
}
